package object;



public class ObjectDemo {
    public static void main(String[] args) {
        /*
        输出引用变量时，默认调用object类的toString()方法
         */
       /* Point p=new Point(100,200);
        System.out.println(p);
        System.out.println(p.toString());

        String str="这是一个点:"+p;
        System.out.println(str);

        Point p1=new Point(100,200);
        Point p2=new Point(100,200);
        System.out.println(p1==p2);//false   ==比较的是地址
        //此处调用的是重写之后的equals(),比较的是属性的值是否相同
        System.out.println(p1.equals(p2));//true*/

        String s1=new String("hello");
        String s2=new String("hello");
        System.out.println(s1.equals(s2));
        StringBuilder builder1=new StringBuilder("hello");
        StringBuilder builder2=new StringBuilder("hello");
        System.out.println(builder1.equals(builder2));
        System.out.println(s1.equals(builder1));
    }
}
